<?php

$this->breadcrumbs = array(
	$model->label(2) => array('index'),
	GxHtml::valueEx($model),
);


$this->menu = array(
    array('label'=>'Back', 'url'=>array($this->backurl),
        'linkOptions'=> array('class' => 'icon icon-arrow-left6 tb-gray'),
    ),
    array('label'=>'Edit Description', 'url'=>array('update','id'=>$model->id),
        'linkOptions'=> array('class' => 'icon icon-pencil4 tb-gray'),
    ),
    array('label'=>'Edit Images', 'url'=>array('updatediagrams','id'=>$model->id),
        'linkOptions'=> array('class' => 'icon icon-image tb-gray'),
    ),
    array('label'=>'Edit Video', 'url'=>array('updatevideo','id'=>$model->id),
        'linkOptions'=> array('class' => 'icon icon-play tb-gray'),
    ),
    array('label'=>'Edit Tags', 'url'=>array('updatetag','id'=>$model->id),
        'linkOptions'=> array('class' => 'icon icon-price-tags tb-gray'),
    ),
    array('label'=>'Delete Drill', 'url'=>array('delete','id'=>$model->id),
        'linkOptions'=> array('class' => 'icon icon-minus-circle2 tb-gray','onClick'=>'return confirm("Do you really want to delete this account ?")'),
    ),

	);

?>


<h2 class="form-header">
    <?php
    echo CHtml::encode($this->pageTitle);
    ?>
</h2>


<?php


// Build the diagrams html content
$diag_html = "-";
if(count($diagrams)>0) {
    $diag_html = '<table class="structure">';
    foreach ($diagrams as $d) {
        $diag_html .=  '<tr>';
        $diag_html .=  '<td><img class="drill-image" src="images/diagrams/'.$d->id.'.'.$d->file_ext.'"></td>';
        $diag_html .=  '</tr>';
    };
    $diag_html .= '</table>';
}


// Build the tags html content
$tag_html = "-";
$tags_array = array();
if(count($tags)>0) {
    foreach ($tags as $t) {
        array_push($tags_array,$t->tag_id);
    };
    $tag_html = implode(" , ",$tags_array);
}


// Build the video html content
if($model->youtube_id!="") {
    $video_html = '<img class="drill-video" src="http://img.youtube.com/vi/' . $model->youtube_id . '/0.jpg">';
}
else {
    $video_html = "-";
}


?>

<div class="view-drill">
<?php $this->widget('zii.widgets.CDetailView', array(
    'data' => $model,
	'attributes' => array(
        'name',
        array(
            'name' => 'category0',
            'type' => 'raw',
            'value' => $model->category0 !== null ? DrillCategory::model()->findByPk($model->category0)->GetFullCategoryName() : null,
        ),
        array(
            'name' => 'players',
            'type' => 'raw',
            'value' => $model->players,
        ),
        array(
            'name' => 'purpose',
            'type' => 'raw',
            'value' => $model->purpose,
        ),
        array(
            'name' => 'description',
            'type' => 'raw',
            'value' => $model->description,
        ),
        array(
            'name' => 'tips',
            'label' => 'Coaching Tips',
            'type' => 'raw',
            'value' => $model->tips,
        ),
        array(
            'label' => 'Images',
            'type' => 'raw',
            'value' => $diag_html,
        ),
        array(
            'label' => 'Video',
            'type' => 'raw',
            'value' => $video_html,
        ),
        array(
            'label' => 'Tags',
            'type' => 'raw',
            'value' => $tag_html,
        ),
        array(
            'name' => 'author',
            'label'=>'Author',
            'type' => 'raw',
            'value' => $model->author !== null ? GxHtml::encode(GxHtml::valueEx($model->author)) : null,
        ),
        'id',
    ),
));

?>
</div>